package propertiesio;

import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class Demo1 {
    public static void main(String[] args) {
        Properties pro = new Properties();
        //增加
        pro.put("路明非","黑龙");
        pro.put("路泽明","白龙");
        pro.put("诺诺","蔷薇");
        System.out.println(pro);
        //删
        pro.remove("路泽明");
        System.out.println(pro);
        //改
        pro.put("诺诺","高冷");
        System.out.println(pro);
        //查
        Object o = pro.get("路明非");
        System.out.println(o);
        System.out.println("----------");
        //遍历
        Set<Object> keySet = pro.keySet();
        for (Object key : keySet) {
            Object value = pro.get(key);
            System.out.println(key+"="+value);
        }
        System.out.println("----------");
        Set<Map.Entry<Object, Object>> entries = pro.entrySet();
        for (Map.Entry<Object, Object> entry : entries) {
            Object key = entry.getKey();
            Object value = entry.getValue();
            System.out.println(key+"="+value);
        }
    }
}
